<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc" %>
<%@ include file="/WEB-INF/inc/script.inc" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<base href="${base}">
    <title>中金通 | 项目详情</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">

	<!-- Data Tables -->
    <link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="css/plugins/dataTables/dataTables.responsive.css" rel="stylesheet">
    <link href="css/plugins/dataTables/dataTables.tableTools.min.css" rel="stylesheet">
    
    <!-- 向导css -->
    <link href="css/plugins/steps/jquery.steps.css" rel="stylesheet">
    
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    
     <!-- 下拉框 -->
    <link href="css/plugins/chosen/chosen.css" rel="stylesheet">
    <style type="text/css">
   	 textarea{
     	resize:none;
    	}
    .detailText
	{
	 padding:6px 12px; 
	}
	.form-control[readonly]{
		background-color: #fff;
			opacity: 1;
	}
	.postion{
	margin-top:6px;
	}
    </style>
</head>

<body>

    <div id="wrapper">

    	<!-- 左侧菜单 -->
        <jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
        <!-- 头部工具栏区 -->
        <jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
        </div>
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>项目管理</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="common/platform">Home</a>
                        </li>
                        <li>
                            <a href="project/nonInStoreList">项目管理</a>
                        </li>
                        <li>
                         <a>项目详情</a>
                        </li>
                    </ol>
                </div>
                <div class="col-lg-2">

                </div>
            </div>
		
		<div class="row" style="margin-top:10px;">
			<div class="col-md-12">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li>
								<a href="project/add">
									 录入项目
								</a>
							</li>
							<li  class="active">
								<a>
								 	项目详情
								</a>
							</li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active">
                                <div class="panel-body">
                                    <div class="wrapper wrapper-content animated fadeInRight ecommerce">
						                  <div>
						                	  <input id="project_flag"  style="display:none" type="hidden" value="${flag}">
						                	  <input id="report_group_id"  style="display:none" type="hidden" value="${report.id}">
						                	  <input type="hidden" name="id" id="group_capital_id" value="${report.employeeId}">
						                	  <input type="hidden" name="id" id="projectId" value="${project.id}">
											<form method="post" id="addForm" enctype="multipart/form-data" action="" class="form-horizontal wizard-big">
											 <h1>项目基本信息</h1>
                                				<fieldset>
                                					<div class="row">
										                    <div class="col-sm-6">
										                       <div class="form-group">
										                           <label class="col-sm-4 control-label">项目名称:</label>
							                                       <div class="col-sm-8 postion" >
							                                    	   ${project.name}
							                                       </div>
										                       </div>
										                    </div>
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                        	<label class="col-sm-2 control-label" style="position:relative;margin-left:-18px;width:19%;">项目编号:</label>
							                                        <div class="col-sm-8 postion">
							                                    	   ${project.code}
							                                        </div>
										                        </div>
										                    </div>
										                 </div>
					                             <div class="row">
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                            <label class="col-sm-4 control-label">项目类型:</label>
							                                        <div class="col-sm-8 postion" >
											                              <c:if test="${project.type eq 1}">债券类 </c:if>
											                              <c:if test="${project.type eq 2}">股权类 </c:if>
							                                        </div>
										                        </div>
										                    </div>
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                            <label class="col-sm-2 control-label" style="position:relative;margin-left:-18px;width:19%;">企业:</label>
							                                        <div class="col-sm-8 postion">
							                                        	<div class="input-group">
											                              <c:if test="${enterpriseList.size() != 0}">
				             													<c:forEach var="i" begin="0" end="${enterpriseList.size()-1}">
															                	<c:if test="${project.enterpriseId eq enterpriseList.get(i).getId()}">
																                	<a href=${ctx}/enterprise/detail/${project.enterpriseId}>${enterpriseList.get(i).getName()}</a>
																                </c:if>
															                </c:forEach>
														             		</c:if>
											                           </div>
							                                        </div>
										                        </div>
										                    </div>
										                 </div>
							                              <div class="row" id="guaranteeTypeDiv"  style="<c:if test="${project.type eq 2}">display:none </c:if>" >
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                            <label class="col-sm-4 control-label">担保方式:</label>
							                                        <div class="col-sm-8 postion">
											                              <c:if test="${project.guaranteeType eq 1}">保证</c:if>
											                              <c:if test="${project.guaranteeType eq 2}">抵押</c:if>
											                              <c:if test="${project.guaranteeType eq 3}">质押</c:if>
											                              <c:if test="${project.guaranteeType eq 4}">留质</c:if>
											                              <c:if test="${project.guaranteeType eq 5}">定金</c:if>
							                                        </div>						                        
						                                        </div>
										                    </div>
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                        	<label class="col-sm-2 control-label" id="guaranteeLabel">抵押人:</label>
							                                        <div class="col-sm-8 postion" >
							                                        	<div class="input-group">
											                              <c:if test="${enterpriseList.size() != 0}">
				             													<c:forEach var="i" begin="0" end="${enterpriseList.size()-1}">
															                	<c:if test="${project.guaranteeEnterpriseId eq enterpriseList.get(i).getId()}">
																                	<a href=${ctx}/enterprise/detail/${project.enterpriseId}>${enterpriseList.get(i).getName()}</a>
																                </c:if>
															                </c:forEach>
														             		</c:if>
											                           </div>
							                                        </div>
										                        </div>
										                    </div>
										                 </div>
							                             <div class="row" id="guaranteeAssessDiv" >
										                    <div class="col-sm-6"  style="<c:if test="${project.type eq 2}">display:none </c:if>" >
																<div class="form-group">
																	<label class="col-sm-4 control-label" id="guaranteeAssessLabel">抵押物状况/评估/备注:</label>
																	<div class="col-sm-8 postion">
																		${project.guaranteeAssess}
																	</div>
																</div>
							                                </div>
							                                 <div class="col-sm-6">
										                        <div class="form-group">
										                            <label class="col-sm-2 control-label">风控经理:</label>
							                                        <div class="col-sm-8 postion">
											                              <c:if test="${approveRoleGroupMemberList.size() != 0}">
				             													<c:forEach var="i" begin="0" end="${approveRoleGroupMemberList.size()-1}">
															                	<c:if test="${project.lawEmployeeId eq approveRoleGroupMemberList.get(i).getEmployeeId()}">
																                	${approveRoleGroupMemberList.get(i).getEmpName()}
																                </c:if>
															                	</c:forEach>
														             		</c:if>
							                                        </div>
										                        </div>
										                    </div>
										                 </div>
							                             <!-- <div class="hr-line-dashed"></div> -->
							                              <div class="row">
							                              	<div class="col-sm-6">
										                        <div class="form-group">
										                        	<label class="col-sm-4 control-label">项目金额:</label>
							                                       <div class="col-sm-8 postion" id="project_amount">
							                                    	   ${project.amount}
							                                       </div>
										                        </div>
										                    </div>
										                    <div class="col-sm-6">
										                        <div class="form-group">
										                            <label class="col-sm-2 control-label">已投金额:</label>
							                                        <div class="col-sm-8 postion">
							                                    	   ${project.amountInvested}
							                                        </div>
										                        </div>
										                    </div>
										                 </div> 
							                            <div class="row">
							                            	<div class="col-sm-12">
																<div class="form-group">
																	<label class="col-sm-2 control-label" id="content-label">项目简介:</label>
																	<div class="col-sm-8 postion">
										                                    ${project.introduction}
								                                	</div>
																</div>
							                                </div>
							                            </div>
							                            <div class="row"> 
							                            	<div class="col-sm-12">
																<div class="form-group">
																	<label class="col-sm-2 control-label" id="content-label1">融资方案:</label>
																	<div class="col-sm-8 postion">
										                                    ${project.plan}
								                                	</div>
																</div>
							                                </div>
							                            </div>
							                             <div class="row"> 
							                            	<div class="col-sm-6">
										                       <div class="form-group">
										                           <label class="col-sm-4 control-label">项目附件:</label>
							                                        <div id="relatedFileId" class="col-sm-8 postion"  style="overflow:auto;">
																		<c:forEach items="${projectAttachmentList}"  var="file">
														       			    <div style="padding-top:4px;">
														        			    <a  href="product/downloadFile?filePath=${file.url}" title=" ${file.contractName}" data-gallery="">${file.contractName}</a>
														        			</div>
																		</c:forEach>
														            </div>
										                       </div>
										                    </div>
									                    </div>
									                    <div class="row" >
													    <div class="col-sm-6">
													        <div class="form-group">
													            <label class="col-sm-4 control-label">尽调文件</label>
													             <div id="relatedFileId" class="col-sm-8 postion"  style="overflow:auto;">
																	<c:forEach items="${projectReportAttachmentList}"  var="file">
													       			    <div style="padding-top:4px;">
													        			    <a  href="product/downloadFile?filePath=${file.url}" title=" ${file.contractName}" data-gallery="">${file.contractName}</a>
													        			</div>
																	</c:forEach>
													            </div>
													        </div>
													    </div>
													  </div>
                                				</fieldset>
                                				
                                				<h1>项目进展</h1>
                                				<fieldset>
                                					<div class="row" >
										                <div class="col-lg-12">
										                    <div class="ibox float-e-margins">
										                    	<label class="control-label">项目进展</label>
										                        <div class="ibox-content">
										                            <table id="modelEditable_comm" class="table table-striped table-bordered table-hover">
										                                <thead>
											                               	 <tr>
											                                    <th>处理时间</th>
											                                    <th>审批人</th>
											                                    <th>审批部门</th>
											                                    <th>审批结果</th>
											                                    <th>审批意见</th>
											                                </tr>
										                              	  </thead>
											                              <tbody>
											                              </tbody>
											                        </table>
										                        </div>
										                    </div>
										                </div>
										            </div> 
                                				</fieldset>
											</form> 
											
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		
        <!-- 底部版权 -->
        <jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>

        </div>
        </div>

   <!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.messages-zh_CN.js" type="text/javascript"></script>
	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<!-- Data picker -->
	<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>

	<!-- Data Tables -->
	<script src="js/plugins/dataTables/jquery.dataTables.min.js"></script>
	<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="js/plugins/dataTables/dataTables.responsive.js"></script>
	<script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script>
    
    <!-- Steps -->
    <script src="js/plugins/staps/jquery.steps.min.js"></script>
    
	<!-- 业务 -->
	<script src="js/jquery.form.js"></script>
	<script src="js/project/project-detail.js"></script>
	
	<!-- Chosen -->
    <script src="js/plugins/chosen/chosen.jquery.js"></script>

	<!-- 产品基本信息 -->
	<script>
		$(document).ready(function() {
			var flag = $("#project_flag").val();
			var wizard = $("#addForm").steps({
                bodyTag: "fieldset",
            });
			if(flag == "true"){
				wizard.steps("insert",1, {
					   title: "尽调小组",
					   content: "<fieldset>"
		               +"<div class=\"row\">"
	                   +"<div class=\"col-lg-12\">"
	                   +"<div class=\"ibox float-e-margins\">"
	                   +"<label class=\"control-label\">尽调小组</label>"
	                   +"<div class=\"ibox-content \">"
	                   +"<table id=\"modelEditable_report\" class=\"table table-striped table-bordered table-hover\">"
	                   +"           <thead>"
	                   +"          <tr>"
	                   +"              <th>姓名</th>"
	                   +"              <th>联系方式</th>"
	                   +"              <th>是否为负责人</th>"
	                   +"           </tr>"
	                   +"           </thead>"
	                   +"           <tbody>"
	                   +"          </tbody>"
	                   +"      </table>"
	                   +"  </div>"
	                   +"</div>"
	                   +"</div>"
	                   +" </div></fieldset>"
					});
				wizard.steps("insert",2, {
					   title: "合同",
					   content: "<fieldset><div class=\"row\">"
	                   +"<div class=\"col-lg-12\">"
	                   +"<div class=\"ibox float-e-margins\">"
	                   +"<label class=\"control-label\">合同</label>"
	                   +"<div class=\"ibox-content\">"
	                   +"<table id=\"modelEditable_contract\" class=\"table table-striped table-bordered table-hover\">"
	                   +"           <thead>"
	                   +"          <tr>"
	                   +"              <th>合同文件</th>"
	                   +"              <th>最后上传人</th>"
	                   +"               <th>上传时间</th>"
	                   +"           </tr>"
	                   +"           </thead>"
	                   +"           <tbody>"
	                   +"          </tbody>"
	                   +"      </table>"
	                   +"  </div>"
	                   +"</div>"
	                   +"</div>"
	                   +" </div>"
					});
				wizard.steps("insert",3, {
					   title: "项目评级",
					   content: "<fieldset><div class=\"row\">"
	                   +"<div class=\"col-lg-12\">"
	                   +"<div class=\"ibox float-e-margins\">"
	                   +"<label class=\"control-label\">项目评级</label>"
	                   +"<div class=\"ibox-content\">"
	                   +"<table id=\"modelEditabl_grade\" class=\"table table-striped table-bordered table-hover\">"
	                   +"           <thead>"
	                   +"          <tr>"
	                   +"              <th>评级</th>"
	                   +"              <th>评级人</th>"
	                   +"               <th>评级附件</th>"
	                   +"               <th>评级时间</th>"
	                   +"           </tr>" 
	                   +"           </thead>"
	                   +"           <tbody>"
	                   +"          </tbody>"
	                   +"      </table>"
	                   +"  </div>"
	                   +"</div>"
	                   +"</div>"
	                   +" </div>"
					});
				wizard.steps("insert",4, {
					   title: "配资情况",
					   content: "<div class=\"row\">"
	                   +"<div class=\"col-sm-6\">"
	                   +"<div class=\"form-group\">"
	                   +"<label class=\"col-sm-4 control-label\">配资情况</label>"
	                   +"<div class=\"col-sm-8\">"
	                   +"<table id=\"modelEditable_asset\" class=\"table table-striped table-bordered table-hover\">"
	                   +"           <thead>"
	                   +"          <tr>"
	                   +"              <th>基金</th>"
	                   +"              <th>配资金额</th>"
	                   +"              <th>配资名称</th>"
	                   +"              <th>状态</th>"
	                   +"               <th>配资时间</th>"
	                   +"           </tr>"
	                   +"           </thead>"
	                   +"           <tbody>"
	                   +"          </tbody>"
	                   +"      </table>"
	                   +"  </div>"
	                   +"</div>"
	                   +"</div>"
	                   +" </div>"
					});
			}
			
			//项目进展初始化
			ProjectProgress.init();
			//尽调文件初始化
			ProjectReport.init();
			//合同文件初始化
			ProjectContract.init();
			//项目评级初始化
			ProjectGrade.init();
			//配资情况初始化
			ProjectAsset.init();
			
			$("a[href=#finish]").css("display","none");
			$("a[href=#previous]").css("display","none");
			$("a[href=#next]").css("display","none");
			$("a[href=#finish]").text("完成");
			$("a[href=#cancel]").css("display","none");
			
			$("li[role=tab]").removeClass("disabled");
			$("li[role=tab]").addClass("done");
			$("li[role=tab]").removeAttr("aria-disabled");
			$("li[role=tab]").first().removeClass("done");
		});
		$("#project_amount").html(formatCurrency($("#project_amount").html()));
		
		function formatCurrency(num) {  
		    num = num.toString().replace(/\$|\,/g,'');  
		    if(isNaN(num))  
		        num = "0";  
		    sign = (num == (num = Math.abs(num)));  
		    num = Math.floor(num*100+0.50000000001);  
		    cents = num%100;  
		    num = Math.floor(num/100).toString();  
		    if(cents<10)  
		    cents = "0" + cents;  
		    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)  
		    num = num.substring(0,num.length-(4*i+3))+','+  
		    num.substring(num.length-(4*i+3));  
		    return (((sign)?'':'-') + num + '.' + cents);  
		}  
	</script>
</body>
</html>